import React from "react"
import { Suspense } from 'react'
import { Switch, Route, Redirect } from "react-router-dom"

export default function routerView(props) {
    // console.log(props);
    return (
        <Suspense fallback="">
            <Switch>
                {
                    props.routes.map(item => {
                        return (
                            <Route key={item.path} path={item.path} commponent={() => {
                                return <item.component rputes={item.children}></item.component>
                            }}></Route>
                        )
                    })
                }
                {/* <Redirect exact from='/' to="/layout/home"></Redirect>
            <Redirect exact from='/layout/home' to="/layout/home/tuijian"></Redirect> */}
            </Switch>
        </Suspense>
    )
}

